{extend name="$base" /}
{block name="resources"}
<link rel="stylesheet" href="WEB_CSS/goods_consult.css">
{/block}
{block name="main"}
{php}
	$data = api('System.Goods.goodsConsultList', ['goods_id' => $goods_id, 'page_index' => $page_index, 'ct_id' => $ct_id]);
	$data = $data['data'];
	$goods_info = api('System.Goods.goodsInfo', ['goods_id' => $goods_id]);
	$goods_info = $goods_info['data'];
	$total_count = $data['total_count'];
	$consult_list = $data['data'];
{/php}
{if condition="$goods_info"}
<div class="breadcrumb">
	<a href="{:__URL('SHOP_MAIN')}">{:lang('home_page')}&nbsp;&gt;&nbsp;</a>
	<span>{$goods_info.category_name}{$goods_info.goods_name}</span>
</div>
<div class="goods-consult-wrap">
	<div class="consult-wrap">
		<div class="title-bar ns-border-color-gray">
			<h4 class="text14 ns-border-color-gray">{:lang('goods_purchase_consultation')}</h4>
		</div>
		<div class="top-wrap ns-border-color-gray">
			<div class="consult-tips">
				<i></i>
				<p class="text12 ns-text-color-gray">{:lang('goods_text')}！</p>
			</div>
			<div class="consult-ask">
				<a href="#askQuestion" class="btn">{:lang('goods_need_consult')}</a>
			</div>
		</div>
		<div class="consult-nav ns-border-color-gray">
			<ul class="ns-border-color">
				<li {if condition="$ct_id eq 0"} class="ns-text-color"{/if}>
					<a href="{:__URL('SHOP_MAIN/goods/consult','goods_id='.$goods_info['goods_id'].'&ct_id=')}" class="text16 ">{:lang('whole')}</a>
				</li>
				
				<li {if condition="$ct_id eq 1"} class="ns-text-color"{/if}>
					<a href="{:__URL('SHOP_MAIN/goods/consult','goods_id='.$goods_info['goods_id'].'&ct_id=1')}" class="text14">{:lang('goods_commodity_consultation')}</a>
				</li>
				
				<li {if condition="$ct_id eq 2"} class="ns-text-color"{/if}>
					<a href="{:__URL('SHOP_MAIN/goods/consult','goods_id='.$goods_info['goods_id'].'&ct_id=2')}" class="text14">{:lang('goods_payment_problem')}</a>
				</li>
				
				<li {if condition="$ct_id eq 3"} class="ns-text-color"{/if}>
					<a href="{:__URL('SHOP_MAIN/goods/consult','goods_id='.$goods_info['goods_id'].'&ct_id=3')}" class="text14">{:lang('goods_invoice_and_warranty')}</a>
				</li>
			</ul>
		</div>
		{if condition="$total_count eq 0"}
		<div class="consult-main ns-border-color-gray">
			<div class="no-record ns-text-color-gray">{:lang('goods_no_consultation_yet')}</div>
		</div>
		{else /}
		<div class="commend-main ns-border-color-gray">
			{volist name="consult_list" id="vo"}
				<div class="consult-list">
					<dl class="ns-text-color-gray">
						<dt class="text12">{:lang('goods_consulting_user')}：</dt>
						<dd class="text12">
							{if condition="$vo.member_name eq ''"}
							{:lang('goods_tourist')}
							{else /}
							{$vo.member_name}
							{/if}
							<span>{:lang('goods_consulting_type')}：
							{if condition="$vo.ct_id eq 1"}
								{:lang('goods_commodity_consultation')}
							{elseif condition="$vo.ct_id eq 2"/}
								{:lang('goods_payment_problem')}
							{else/}
							    {:lang('goods_invoice_and_warranty')}
							{/if}
							</span>
							<time>[{$vo.consult_addtime | getTimeStampTurnTime}]</time>
						</dd>
					</dl>
					<dl>
						<dt class="text12">{:lang('goods_consultation_content')}：</dt>
						<dd class="text12">
							<p>{$vo.consult_content}</p>
						</dd>
					</dl>
					{if condition="$vo.consult_reply neq ''"}
					<dl>
						<dt class="text12">{:lang('goods_merchant_reply')}：</dt>
						<dd class="text12">
							<p>{$vo.consult_reply}</p>
							<time>[{$vo.consult_reply_time | getTimeStampTurnTime}]</time>
						</dd>
					</dl>
					{/if}
				</div>
			{/volist}
		</div>
		{if condition="$total_count neq 0"}
		<ul class="pager" data-ride="pager" data-elements="prev,nav,next,total_page_text,goto" data-rec-per-page="{$page_size}" data-page="{$page_index}" data-rec-total="{$total_count}" id="myPager"></ul>
		{/if}
		{/if}

		<div class="ncs-goods-title-bar ns-border-color consultation-title" id="askQuestion">{:lang('goods_publish_consultation')}</div>

		<div class="consult-form ns-border-color-gray">
			<dl>
				<dt class="text14">{:lang('goods_consulting_type')}：</dt>
				<dd class="text14">
					<label class="text12"><input type="radio" name="class_id" value="1" checked="checked"> {:lang('goods_commodity_consultation')}</label>
					<label class="text12"><input type="radio" name="class_id" value="2"> {:lang('goods_payment_problem')}</label>
					<label class="text12"><input type="radio" name="class_id" value="3"> {:lang('goods_invoice_and_warranty')}</label>
				</dd>
			</dl>
			<dl>
				<dt class="text14">{:lang('goods_consultation_content')}：</dt>
				<dd class="text14">
					<textarea id="consult_content" class="ns-border-color-gray"></textarea>
					<span id="consult_char_count"></span>
				</dd>
			</dl>
			<dl>
				<dt class="text14">&nbsp;</dt>
				<dd class="text14">
					<input id="captcha" class="captcha ns-text-color-gray ns-border-color-gray text w100" placeholder="{:lang('please_enter_verification_code')}" type="text" maxlength="4">
					<div class="code ns-border-color-gray">
						<div class="arrow"></div>
						<div class="code-img">
							<a href="javascript:void(0)">
								<img id="verify_img" src="{:__URL('SHOP_MAIN/captcha')}" alt="captcha" onclick="this.src='{:__URL('SHOP_MAIN/captcha?tag=1')}'+'&send='+Math.random()" />
							</a>
						</div>
						<a href="javascript:void(0);" id="captcha_hide" class="close" title="{:lang('goods_close')}"><i></i></a>
					</div>
					<a href="javascript:void(0);" id="consultSubmit" title="{:lang('goods_publish_consultation')}" class="btn btn-primary">{:lang('goods_publish_consultation')}</a>
				</dd>
			</dl>
		</div>

	</div>
	<div class="goods-info">
		<div class="title ns-bg-color-gray-fadeout-50 ns-border-color-gray">{:lang('goods_commodity_information')}</div>
		<div class="content ns-border-color-gray">
			<dt class="goods-name">
				<a href="{:__URL('SHOP_MAIN/goods/detail','goods_id='.$goods_info['goods_id'])}" target="_blank">{$goods_info.goods_name}</a>
			</dt>
			<dd class="goods-pic">
				<a href="{:__URL('SHOP_MAIN/goods/detail','goods_id='.$goods_info['goods_id'])}" target="_blank">
					<img src="{:__IMG($goods_info['picture_detail']['pic_cover_small'])}" />
				</a>
			</dd>
			<dd class="goods-foot">
				<span>{:lang('goods_sale_price')}：</span>
				<span class="saleP">￥{$goods_info.promotion_price}</span>
			</dd>
		</div>
	</div>
</div>
<input type="hidden" id="goods_id" value="{$goods_info.goods_id}"/>
<input type="hidden" id="goods_name" value="{$goods_info.goods_name}"/>
{else/}
<script>
	location.href = __URL(SHOPMAIN);
</script>
{/if}
{/block}
{block name="script"}
<script type="text/javascript" src="WEB_JS/goods_consult.js"></script>
{/block}